import React from "react";
import ReactECharts from "echarts-for-react";

// 在此组件中绘制一个简单的折线图
const CardChart = ({ count }) => {
  // 返回折线图的配置对象
  const option = {
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "shadow",
      },
    },
    grid: {
      left: "3%",
      right: "4%",
      bottom: "3%",
      containLabel: true,
    },
    xAxis: [
      {
        type: "category",
        data: [
          "CPU",
          "GPU",
          "主板",
          "内存",
          "硬盘",
          "固态硬盘",
          "评论",
          "用户",
          "配置",
        ],
        axisTick: {
          alignWithLabel: true,
        },
      },
    ],
    yAxis: [
      {
        type: "value",
      },
    ],
    series: [
      {
        name: "数量",
        type: "bar",
        barWidth: "60%",
        data: count,
      },
    ],
  };
  return (
    <div>
      <ReactECharts option={option} />
    </div>
  );
};

export default CardChart;
